package models

import (
	database "renter/infrastructure"
	"time"
)

type User struct {
	Id         int64     `json:"id" gorm:"primary_key,AUTO_INCREMENT"`
	Nickname   string    `json:"nickname"`
	Avatar     string    `json:"avatar"`
	CreateTime time.Time `json:"createTime"`
}

func (a *User) TableName() string {
	return "tb_user"
}

func SelectUserById(id int64) *User {
	var result = User{}
	database.GetDB().Where("id = ?", id).First(&result)
	return &result
}

func insertUser(user *User) {
	database.GetDB().Where(user)
}
